#include <iostream>
#include <algorithm>
using namespace std;


const int N = 55;
int a[N];

int main(){

    int n; cin >> n;
    for (int i = 0; i < n; i++) cin >> a[i];
    sort(a, a + n - 1);
    bool flag = true;
    for (int i = 0; i < n; i++){
        if (a[0] == a[i]) continue;
        if (a[i] % a[0]) {
            flag = 0;
            break;
        }
        if (i == 2) int j  = 0;
        int tmp = a[i] / a[0];
        tmp %= 2;
        if (tmp) {
            flag = 0;
            break;
        }
    }
    if (flag) cout << "YES" << endl;
    else  cout << "NO" << endl;
    return 0;
}
